<?php
session_start();
if (isset($_REQUEST['username']) && isset($_REQUEST['password'])) {
    $user = $_REQUEST['username'];
    $password = $_REQUEST['password'];
    $result = "http://nibble.li/twittertido/web/login.php?user=$user&password=$password";
    $correct = file_get_contents($result, 0, null, null);
    if ($correct > 0) {
        $_SESSION['logueado'] = true;
        $_SESSION['user_id'] = $correct;
        $_SESSION['user'] = $user;
    }
    echo $correct;
} else {
    echo -2;
}
?>
